<script setup lang="ts">
import { ref } from 'vue'
import topHeader from './components/top-header.vue'
import leftMenu from './components/left-menu.vue'
import breadcrumb from './components/breadcrumb.vue'
import { useRoute } from 'vue-router'

const route = useRoute()
const breadcrumbRef = ref<InstanceType<typeof breadcrumb>>()

const updateTitle = (title: string) => {
  breadcrumbRef.value!.updateTitle(title)
}
</script>
<template>
  <!-- 界面布局 -->
  <div class="main">
    <div class="header">
      <topHeader />
    </div>
    <div class="main-container">
      <div class="aside">
        <leftMenu />
      </div>
      <div class="main-content">
        <breadcrumb
          v-if="route.path !== '/index' && route.path !== '/xxgl'"
          ref="breadcrumbRef"
          @updateTitle="updateTitle"
        ></breadcrumb>
        <router-view class="router" />
      </div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.main {
  width: 100%;
  height: 100%;
  .header {
    width: 100%;
    height: 52px;
    float: left;
    position: relative;
    padding: 0 10px;
    z-index: 1;
  }
  .main-container {
    width: 100%;
    height: calc(100% - 52px);
    display: flex;
    .aside {
      // width: 180px;
      height: 100%;
      float: left;
    }
    .main-content {
      flex: 1;
      width: 0;
      height: 100%;
      float: left;
      padding: 10px;
      background-color: #ecf1fa;
    }
  }
}
.router {
  height: calc(100% - 30px) !important;
}
</style>
